<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/4/24/024
 * Time: 20:12
 */

namespace app\admin\validate;

class MenuValidate extends \think\Validate
{

    const SCENE_ADD = 'add'; //添加权限
    const SCENE_REMOVE = 'remove'; //删除权限
    const SCENE_MODIFY = 'modify'; //修改权限



    protected $rule = [
        'id' => 'require|number',
        'auth_id' => 'require|number',
        'icon_id' => 'require|number',
        'name' => 'require|max:32',
    ];


    protected $message  = [
        'auth_id.require' => '请选择路由',
        'icon_id.require' => '请选择图标',
        'name.require' => '请填写图标编号',
        'name.max' => '图标编号不能超过32个字符',

    ];

    protected $scene  = [
       self::SCENE_ADD => ['name','auth_id', 'icon_id'],
       self::SCENE_MODIFY => ['id', 'name','auth_id', 'icon_id'],
       self::SCENE_REMOVE => ['id'],
    ];
    


}